package com.book.web;

import com.book.pojo.Book;
import com.book.pojo.Page;
import com.book.service.Impl.bookServiceImpl;
import com.book.service.bookService;
import com.book.utils.webUtils;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class clientBookServlet extends baseServlet{
    bookService bookService=new bookServiceImpl();
    protected void page(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        int pageNo = webUtils.parseInt(request.getParameter("pageNo"),1);
        int pageSize = webUtils.parseInt(request.getParameter("pageSize"), Page.PAGE_SIZE);
        Page<Book> page = bookService.page(pageNo, pageSize);
        page.setUrl("client/book?action=page");
        //保存到request域中
        request.setAttribute("page", page);
        request.getRequestDispatcher("/pages/client/index.jsp").forward(request, response);
    }
}
